home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
rascal.arc
/
UTILITY.DOC
< prev
Wrap
Text File
|
1980-01-01
|
14KB
|
421 lines
November 1983
This document tells how to use the Rascal program debugger,
lister, and library routines. These utilities make writing Rascal
programs faster and easier. This manual assumes you are familiar
with MS DOS and Microsoft BASIC.
RASCAL UTILITIES USER'S MANUAL RASCAL UTILITIES USER'S MANUAL
Manual version: 1.00
Software version: 1.05
Marty Franz
525 W. Walnut St., Kalamazoo, MI 49007
(616) 344-1821
(C) Copyright 1983 Marty Franz - All rights reserved
111483105 Rascal Utilities User's Manual
INTRODUCTION INTRODUCTION
Rascal is a complete BASIC programming system for the IBM
Personal Computer. It features a text editor for entering and
changing Rascal statements, and a preprocessor for converting
Rascal programs into BASIC programs that can be executed on the
PC. The preprocessor and editor User's Manuals describe these
programs in detail. This manual concerns itself with several
additional programs that can make writing and debugging Rascal
programs easier:
- LLIST.EXE, a program to list your Rascal source files on a
printer with your choice of several formatting options,
- DEBUG.INC, a debugger module that lets you debug your
Rascal programs at the procedure level, and
- the files SCREEN.INC and INPUT.INC, two library files
containing procedures that can be included into your Rascal
programs to make your programming easier.
PROGRAM REQUIREMENTS PROGRAM REQUIREMENTS
To successfully use these utility programs, your need an IBM
PC or XT with:
- at least 64KB of memory,
- at least one single-sided diskette drive,
- a color or monochrome adapter, and a monitor capable of
displaying 80-character lines,
- MS DOS version 1.1 or 2.0, and
- the files BASICA.COM or BASIC.COM.
Page 2 111483105 Rascal Utilities User's Manual
THE PROGRAM DEBUGGER THE PROGRAM DEBUGGER
The Rascal program debugger is used during development to
trace Rascal program execution at the procedure level. (For more
information about "procedures" and the rest of the Rascal
language, please consult the Rascal User's Manual.) By including
the file DEBUG.INC in your program during preprocessing, and
using the DEBUG and NODEBUG statements, you can perform these
helpful functions when you are testing your program from within
BASIC:
- you can see the execution of each procedure on the screen
as it is called by a DO or GOSUB statement,
- you can set a trap in your program to stop when a certain
procedure is reached, (this is called a "breakpoint")
- you can stop your program, exit into BASIC, print the
values of your variables, then resume execution again, and
- you can dump the "stack" of procedures called whenever you
stop the program's execution.
USING THE DEBUGGER USING THE DEBUGGER
To use the program debugger, you need to include the file
DEBUG.INC into your Rascal source program. Then, you must select
the individual procedures to be debugged by using the DEBUG and
NODEBUG Rascal statements. Here's an example:
INCLUDE DEBUG.INC 'Include the debugger procedures.
DEBUG 'Turn on debugging.
PROCEDURE MAIN 'First procedure to be debugged.
.
.
ENDPROC
PROCEDURE ...
. 'More procedures to be debugged are
. here.
ENDPROC
NODEBUG 'Turn off debugging.
INCLUDE SCREEN.INC 'Procedures here will not be
debugged.
The statements DEBUG and NODEBUG work just like a switch. When
DEBUG is encountered, all the procedures following it will have
calls to debugger routines generated after their first and last
Page 3 111483105 Rascal Utilities User's Manual
statements. When NODEBUG is reached, this generation is turned
off. Both DEBUG and NODEBUG must appear in a source file outside
a procedure. When you run your program from BASIC, these extra
calls help the debugger determine where in execution is in the
program.
DEBUGGING IN BASIC DEBUGGING IN BASIC
After your program has been preprocessed with debugger
statements in it, it can be run from BASIC. The debugger will
get control before procedure MAIN does, and will display a list
of available commands and prompt you for one with "debug:"
displayed on line 25 of the screen. The commands you can use in
the debugger are:
X to exit to BASIC with a STOP statement. This
allows you to print key variables in your program
and list parts of your code. The BASIC CONT
command can be used to continue execution.
B to have the debugger prompt you for a breakpoint.
Enter the name of the procedure where you want the
program to stop next. If you don't want to stop at
any procedures during execution, just press enter.
D to display the names of the procedures currently
active, along with their appropriate line numbers.
This will be shown enclosed by a frame in the
upper right corner of your screen. The topmost
procedure in the list will be the one currently
being executed, with the one below it being the one
that called it, etc. This can be used to help you
trace the location of bugs in the program.
G to resume execution of the program.
As your program is running, the procedures being executed are
displayed on line 25 of the screen along with the line number
they start on. You can stop execution of the program at any time
by pressing F10. This will enter the debugger at the next
procedure encountered.
Besides stopping at a breakpoint or by F10 on the keyboard,
the debugger is entered whenever a BASIC error is encountered.
The error message and line number will be displayed on line 25 of
the screen. A line number of 65535 means the error happened in
direct mode.
The debugger is in Rascal source code and can be changed for
special needs. You might want to do this if you are developing
programs that do a lot of color or graphics, since the debugger
assumes a text screen with 25 lines of 80 characters. All of the
debugger's variable definitions are contained in the procedure
DEBUG.SETUP, which is called before MAIN is when your program is
started.
Page 4 111483105 Rascal Utilities User's Manual
THE LLIST PROGRAM THE LLIST PROGRAM
The file LLIST.EXE on your Rascal program disk is a
general-purpose print utility. With it, you can print your
Rascal source files, selecting any of several formatting
options.
LLIST's syntax is similar to other MS DOS commands. You must
supply it the name of the file you want to list, and additional
information through program "switches" to select any extra
formatting options. LLIST's format is:
A>LLIST d:filename.ext {/n /p /s /ln /wn /tn}
Only the "d:filename.ext" is required. If you don't supply it,
LLIST will display a brief summary of its operation and options
and prompt you for it. The switches in squiggly braces control
these options:
/n omits page headings from the listing. Normally,
your listing will have the filename, date, time,
and page number at the top of each page. The /n
switch overrides this.
/p is used when you are printing on single-sheet
paper. This will pause the program between pages
so you can change sheets. Press the "enter" key
to continue with the next page.
/s includes line numbers in the listing. This switch
is especially useful when you are debugging Rascal
programs and you need to match the line numbers of
the preprocessor's error messages to the source
statement.
/ln sets the length of a page to n lines. This is
useful when printing on short forms or in
compressed format. Normally, this option is set
to 60 lines/page.
/tn sets tab stops every n columns. Normally, you
don't need to use this with Rascal source files,
since it is set by default to 4 columns. You
might need to change this option for other
languages like Pascal or C. The maximum tab
setting allowed is 10.
Page 5 111483105 Rascal Utilities User's Manual
/wn sets the width of a page to n characters/line.
Use this option for printing in compressed format,
since the default is 80 characters/line. Up to
132 characters may be used.
Note: _____
This option is unaffected by the setting of the MS
DOS "mode" command.
For normal use printing Rascal source files, you shouldn't
need to use any of these options. Here are some examples of
LLIST:
A>llist a:debug.inc
prints the file A:DEBUG.INC with standard tabs,
page length (60 lines/page), and page width (80
characters/line).
A>llist screen.inc /t2 /p
prints SCREEN.INC from the A: drive with tabs set
every 2 columns and a pause after every page.
A>llist b:input.inc /w132 /l82 /p
prints the file INPUT.INC on drive B: with a page
width of 132 characters/line and a page length of
82 lines/page. The switch /p is used to that the
paper can be manually advanced after every page.
This combination of options can be used for
extremely compressed listings on an Epson or IBM PC
printer.
Page 6 111483105 Rascal Utilities User's Manual
SAMPLE LIBRARY FILES SAMPLE LIBRARY FILES
The files SCREEN.INC and INPUT.INC on the Rascal program disk
contain several useful procedures for handling screen input and
output.
SCREEN.INC contains routines for drawing boxes and frames on
the screen, putting status messages on line 24, and drawing
titles and headings.
INPUT.INC contains routines for getting strings with INKEY$,
reading a single character from the keyboard, and simulating a
blinking cursor under program control.
These library files can be included in your programs with the
statements:
INCLUDE SCREEN.INC
and
INCLUDE INPUT.INC
Descriptions of the routines can be found in the files
themselves. Studying them is also a good way to learn more about
using Rascal. The sample Rascal programs CHARS.RAS, ATTRIB.RAS
and SDIR.RAS all make use of these procedures.
Page 7 111483105